#!/bin/bash
# ********************************************
# * 作者：			张林锐
# * 脚本功能：	shell脚本
# * 脚本时间：	2025-09-18:20-05-14
# * 联系：			2477116273@qq.com
# ********************************************

fun3(){
  nginx_status=$(systemctl status nginx | sed -n '/Active:/p' | awk -F ' ' '{print$2}')
  if [[ "$nginx_status" == "active"  ]]
  then
    echo "The web service is running"
  else
    echo "The web service is NOT running"
  fi
}
fun3

fun2(){
  if rpm -q nginx
  then
    echo "已安装"
    echo "<h1>I am zhanglinrui</h1>" > /usr/share/nginx/html/index.html
  else
    yum install nginx -y > /dev/null
    if [ $? -eq 0 ]
    then
      echo "<h1>I am zhanglinrui</h1>" > /usr/share/nginx/html/index.html
      echo "安装成功，测试页面已写入"
    else
      echo "未知错误"
    fi
  fi
}


fun1(){
    
  if [ $# -eq 2 ] 
  then
    if [[ $1 =~ ^[0-9]+$ && $2 =~ ^[0-9]+$ ]]
    then
      if (($1 == $2)) 
      then
       echo "$1 equals $2"
      elif (($1 > $2))
      then
        echo "$2 littler than $1"
      else
        echo "$1 greater than $2"
      fi
    else 
      echo "不是整数"
      exit
    fi
  else
    echo “not enough parameters”
  fi

}


